﻿using System;
using System.ComponentModel;
using SQLite;

namespace Cashbook.Models
{
	[Table("Customers")]
	public class Customer : INotifyPropertyChanged
	{
		private int _id;
		[PrimaryKey, AutoIncrement]
		public int Id
		{
			get
			{
				return _id;
			}
			set
			{
				this._id = value;
				OnPropertyChanged(nameof(Id));
			}
		}

		

		private string _companyName;
		[NotNull]
		[MaxLength(50)]
		public string CompanyName
		{
			get
			{
				return _companyName;
			}
			set
			{
				this._companyName = value;
				OnPropertyChanged(nameof(CompanyName));
			}
		}

		private string _email;		
		[MaxLength(150)]       
		public string Email
		{
			get
			{
				return _email;
			}
			set
			{
				this._email = value;
				OnPropertyChanged(nameof(Email));
			}
		}

		private string _phone;		
		[MaxLength(150)]
		public string Phone
		{
			get
			{
				return _phone;
			}
			set
			{
				this._phone = value;
				OnPropertyChanged(nameof(Phone));
			}
		}

		public event PropertyChangedEventHandler PropertyChanged;
		private void OnPropertyChanged(string propertyName)
		{
			this.PropertyChanged?.Invoke(this,
			  new PropertyChangedEventArgs(propertyName));
		}

	}
}
